package com.liqing.movecomment.exception;

/**
 * @author
 * @author 2023-04-15 15:20
 * description:
 */
public class LdException extends RuntimeException {
    private Integer code;
    private String description;

    public LdException(Integer code, String description) {
        super(description);
        this.code = code;
        this.description = description;
    }

    public LdException(LdExceptionEnum exceptionEnum) {
        super(exceptionEnum.EXPIRE_ERROR.getDescription());
        this.code = exceptionEnum.EXPIRE_ERROR.getCode();
        this.description = exceptionEnum.EXPIRE_ERROR.getDescription();
    }

    //<editor-fold defaultstate="collapsed" desc="delombok">
    @SuppressWarnings("all")
    public Integer getCode() {
        return this.code;
    }

    @SuppressWarnings("all")
    public String getDescription() {
        return this.description;
    }

    @SuppressWarnings("all")
    public void setCode(final Integer code) {
        this.code = code;
    }

    @SuppressWarnings("all")
    public void setDescription(final String description) {
        this.description = description;
    }

    @Override
    @SuppressWarnings("all")
    public boolean equals(final Object o) {
        if (o == this) return true;
        if (!(o instanceof LdException)) return false;
        final LdException other = (LdException) o;
        if (!other.canEqual((Object) this)) return false;
        final Object this$code = this.getCode();
        final Object other$code = other.getCode();
        if (this$code == null ? other$code != null : !this$code.equals(other$code)) return false;
        final Object this$description = this.getDescription();
        final Object other$description = other.getDescription();
        if (this$description == null ? other$description != null : !this$description.equals(other$description)) return false;
        return true;
    }

    @SuppressWarnings("all")
    protected boolean canEqual(final Object other) {
        return other instanceof LdException;
    }

    @Override
    @SuppressWarnings("all")
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final Object $code = this.getCode();
        result = result * PRIME + ($code == null ? 43 : $code.hashCode());
        final Object $description = this.getDescription();
        result = result * PRIME + ($description == null ? 43 : $description.hashCode());
        return result;
    }

    @Override
    @SuppressWarnings("all")
    public String toString() {
        return "LdException(code=" + this.getCode() + ", description=" + this.getDescription() + ")";
    }
    //</editor-fold>
}
